#include "read_disk.h"

void read_disk(uint8_t sector_size, uint8_t track, uint8_t start_sector, uint8_t head, uint8_t drive,
          uint8_t *buffer, uint8_t *status, uint8_t *sectors_read)
{
    uint16_t result;

    // asm volatile("push %%cs; pop %%es; int $0x13"
    //              : "=a"(result)
    //              : "a"(0x200 | sector_size), "b"(buffer),
    //                "c"(track << 8 | start_sector), "d"(head << 8 | drive)
    //              : "es", "memory");

    asm volatile("int $0x13"
                 : "=a"(result)
                 : "a"(0x0200 | sector_size), "b"(buffer),
                   "c"(track << 8 | start_sector), "d"(head << 8 | drive)
                 : "memory");

    *status = result >> 8;
    *sectors_read = result >> 0;
}